import os
from tkinter import filedialog

def select_file():
    '''选择文件,获取文件路径'''
    s1 = filedialog.askopenfilename()
    return s1       #返回为文件夹绝对路径


def select_mkdir(title="选择文件夹",initialdir="D://"):
    '''选择文件夹,获取文件夹绝对路径'''
    #title为标题,initialdir为打开的起始路径
    s2 = filedialog.askdirectory(title=title,initialdir=initialdir)
    # 路径拼接
    s3 = os.path.join(s2+"/")    
    return s3       #返回为文件夹绝对路径

if __name__ == "__main__":
    ss = select_mkdir()
    print(ss)